{temp('admin/head')}
	
</head>
<body class="page-body">
		
		{temp('admin/left')}
			
			{temp('admin/top')}
			
			<!-- Basic Setup -->
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">{$tit}</h3>
					<div class="panel-options">
						
						<a href="#" onclick="cj()">
							<i class="fa fa-pencil-square-o"></i>
							添加行业
						</a>
						
						<a href="{$_url}/admin/?act=recruit&met=industry{$gnpd}">
							<i class="fa-rotate-right"></i>
							刷新
						</a>
						
					</div>
				</div>
				<div class="panel-body">
					
					<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$("#example").dataTable({
							"oLanguage": {
								"sUrl":"{$adstyle}/js/datatables/js/zn.txt"
							},
							aLengthMenu: [
								[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]
							]
						});
					});
					</script>
					
					<div data-pattern="priority-columns" data-add-display-all-btn="false" data-add-focus-btn="false">
					
					<table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
						<thead>
							<tr>
								<th>ID号</th>
								<th>行业名称</th>
								<th>操作</th>
							</tr>
						</thead>
					
						<tbody class="middle-align">
							{if(@$rs)}
							{foreach($rs as $k=>$v)}
							<tr>
								<td>{$v['id']}</td>
								<td>{$v['name']}</td>
								<td>
									<button onClick="bianji({$v['id']},'{$v['name']}')" class="btn btn-secondary btn-sm btn-icon icon-left">
										编辑
									</button>
									
									<button onClick="shanchu({$v['id']})" class="btn btn-danger btn-sm btn-icon icon-left">
										删除
									</button>
									
								</td>
							</tr>
							{/foreach}
							{/if}
						</tbody>
					</table>
					
					</div>
					
				</div>
			</div>
			
			<script type="text/javascript">
				function cj(){//创建分组
					jQuery('#groups').modal('show', {backdrop: 'static'});
				}
				function chuandi(){//创建分组post提交
					var name = $("#groups #name").val();
					$.post('{$_url}/admin/?act=recruit&met=industry_add{$gnpd}',{name:name},function(data){
						showAjaxModal(data);
						if(data == '添加成功'){
							$("#queding").attr("onclick","tiao()");
						}
					});
				}
				function bianji(id,name){//修改分组名称
					jQuery('#groups_name').modal('show', {backdrop: 'static'});
					jQuery('#groups_name #name').val(name);
					$("#groups_xg").attr("onclick","xg("+id+")");
				}
				function xg(id){//修改分组名称post提交
					var name = $("#groups_name #name").val();
					$.post('{$_url}/admin/?act=recruit&met=industry_update{$gnpd}',{id:id,name:name},function(data){
						showAjaxModal(data);
						if(data == '修改成功'){
							$("#queding").attr("onclick","tiao()");
						}
					});
				}
				function shanchu(id){//删除
					$.post('{$_url}/admin/?act=recruit&met=industry_del{$gnpd}',{id:id},function(data){
						showAjaxModal(data);
						if(data == '删除成功'){
							$("#queding").attr("onclick","tiao()");
						}
					});
				}
				function showAjaxModal(data){//ajax弹窗
					jQuery('#modal-7').modal('show', {backdrop: 'static'});
					jQuery('#modal-7 .modal-body').html(data);
				}
				function tiao(){//创建成功跳转
					window.location.href='{$_url}/admin/?act=recruit&met=industry{$gnpd}';
				}
			</script>
			
		{temp('admin/foot')}
	
	<!-- 添加行业开始 -->
	<div class="modal fade" id="groups">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title">添加行业</h4>
				</div>
				<div class="modal-body">
					<div class="row">
						<div class="col-sm-12">
							<div class="panel-body">
							<form role="form" class="form-horizontal">
								<div class="form-group">
									<label class="col-sm-2 control-label">行业名称</label>
									<div class="col-sm-10">
										<input type="text" class="form-control" id="name" placeholder="30个字符以内">
									</div>
								</div>
								</form>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<input type="button" class="btn btn-info" data-dismiss="modal" value="确定" onclick="chuandi()" >
				</div>
			</div>
		</div>
	</div>
	<!-- 添加行业结束 -->
	
	<!-- 修改行业名称开始 -->
	<div class="modal fade" id="groups_name">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title">修改行业名称</h4>
				</div>
				<div class="modal-body">
					<div class="row">
						<div class="col-sm-12">
							<div class="panel-body">
							<form role="form" class="form-horizontal">
								<div class="form-group">
									<label class="col-sm-2 control-label">行业名称</label>
									<div class="col-sm-10">
										<input type="text" class="form-control" id="name" value="">
									</div>
								</div>
								</form>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<input type="button" class="btn btn-info" data-dismiss="modal" value="确定" id="groups_xg">
				</div>
			</div>
		</div>
	</div>
	<!-- 修改行业名称结束 -->
	
	<!-- Modal 7 (Ajax Modal)-->
	<div class="modal fade" id="modal-7">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title">删除行业</h4>
				</div>
				<div class="modal-body">
					Content is loading...
				</div>
				<div class="modal-footer">
					<button id="queding" type="button" class="btn btn-info" data-dismiss="modal">确定</button>
				</div>
			</div>
		</div>
	</div>
	
	<!-- Imported styles on this page -->
	<link rel="stylesheet" href="{$adstyle}/js/datatables/dataTables.bootstrap.css">

	<!-- Bottom Scripts -->
	<script src="{$adstyle}/js/bootstrap.min.js"></script>
	<script src="{$adstyle}/js/TweenMax.min.js"></script>
	<script src="{$adstyle}/js/resizeable.js"></script>
	<script src="{$adstyle}/js/joinable.js"></script>
	<script src="{$adstyle}/js/xenon-api.js"></script>
	<script src="{$adstyle}/js/xenon-toggles.js"></script>
	<script src="{$adstyle}/js/datatables/js/jquery.dataTables.min.js"></script>

	<!-- Imported scripts on this page -->
	<script src="{$adstyle}/js/datatables/dataTables.bootstrap.js"></script>
	<script src="{$adstyle}/js/rwd-table/js/rwd-table.min.js"></script>

	<!-- JavaScripts initializations and stuff -->
	<script src="{$adstyle}/js/xenon-custom.js"></script>

</body>
</html>